

<%@ page import="ar.com.hakasoft.entities.Factura" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'factura.label', default: 'Factura')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${facturaInstance}">
            <div class="errors">
                <g:renderErrors bean="${facturaInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${facturaInstance?.id}" />
                <g:hiddenField name="version" value="${facturaInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="dietetica"><g:message code="factura.dietetica.label" default="Dietetica" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'dietetica', 'errors')}">
                                    <g:select name="dietetica.id" from="${ar.com.hakasoft.entities.Dietetica.list()}" optionKey="id" value="${facturaInstance?.dietetica?.id}" noSelection="['null': '']" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="vendedor"><g:message code="factura.vendedor.label" default="Vendedor" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'vendedor', 'errors')}">
                                    <g:select name="vendedor.id" from="${ar.com.hakasoft.entities.Vendedor.list()}" optionKey="id" value="${facturaInstance?.vendedor?.id}" noSelection="['null': '']" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="precioTotal"><g:message code="factura.precioTotal.label" default="Precio Total" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'precioTotal', 'errors')}">
                                    <g:textField name="precioTotal" value="${fieldValue(bean: facturaInstance, field: 'precioTotal')}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="username"><g:message code="factura.username.label" default="Username" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'username', 'errors')}">
                                    <g:textField name="username" value="${facturaInstance?.username}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="fecha"><g:message code="factura.fecha.label" default="Fecha" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'fecha', 'errors')}">
                                    <g:datePicker name="fecha" precision="day" value="${facturaInstance?.fecha}"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="fueCobrada"><g:message code="factura.fueCobrada.label" default="Fue Cobrada" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'fueCobrada', 'errors')}">
                                    <g:checkBox name="fueCobrada" value="${facturaInstance?.fueCobrada}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="fueEliminada"><g:message code="factura.fueEliminada.label" default="Fue Eliminada" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'fueEliminada', 'errors')}">
                                    <g:checkBox name="fueEliminada" value="${facturaInstance?.fueEliminada}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="fueFinalizada"><g:message code="factura.fueFinalizada.label" default="Fue Finalizada" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'fueFinalizada', 'errors')}">
                                    <g:checkBox name="fueFinalizada" value="${facturaInstance?.fueFinalizada}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="itemFactura"><g:message code="factura.itemFactura.label" default="Item Factura" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'itemFactura', 'errors')}">
                                    
<ul>
<g:each in="${facturaInstance?.itemFactura?}" var="i">
    <li><g:link controller="itemFactura" action="show" id="${i.id}">${i?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="itemFactura" action="create" params="['factura.id': facturaInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'itemFactura.label', default: 'ItemFactura')])}</g:link>

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="precioParcial"><g:message code="factura.precioParcial.label" default="Precio Parcial" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: facturaInstance, field: 'precioParcial', 'errors')}">
                                    <g:textField name="precioParcial" value="${fieldValue(bean: facturaInstance, field: 'precioParcial')}" />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
